<template>
	<div>
		<Banner></Banner>
		<Icon></Icon>
		<Tabs></Tabs>
		<Category :propcategory="CategoryList"></Category>
		<Spike :propspike="SpikeList"></Spike>
		<Lunbo></Lunbo>
		<Destination :propsDestination="DestinationList"></Destination>
		<Travel></Travel>
		<BottomNav :propsurl='arrurl'></BottomNav>
		<Redpage></Redpage>
	</div>
	
</template>

<script>
	import{mapState} from 'vuex'
	import Banner from './page/Banner.vue'
	import Icon from './page/Icon.vue'
	import Tabs from './page/Tabs.vue'
	import Spike from './page/Spike.vue'
	import Lunbo from './page/Lunbo.vue'
	import Category from './page/Category.vue'
	import Redpage from './page/Redpage.vue'
	import Destination from './page/Desitination.vue'
	import Travel from './page/Travel.vue'
	
	import BottomNav from '../default/BottomNav.vue'
	export default{
		name:'Home',
		components:{
			Banner,
			Icon,
			Tabs,
			Spike,
			Lunbo,
			BottomNav,
			Category,
			Redpage,
			Destination,
			Travel
		},
		data(){
			return{
				arrurl:[require('@/assets/img/nav2-1.png'),require('@/assets/img/nav3-1.png'),require('@/assets/img/nav4-1.png')],
				SpikeList:[],
				DestinationList:[],
				CategoryList:[],
			}
		},
		computed:{
			...mapState(['cityName'])
		},
		created(){
			//备份
			let that=this
			//向dataHome.json发起异步请求
			this.axios.get('/api/data.json').then( (res)=>{
				let data={}
				data=res.data.Homemsg[0]
				for(var i in res.data.Homemsg){
					if(res.data.Homemsg[i].city==this.cityName){
						 data=res.data.Homemsg[i]
					}
				}
				// console.log(this.cityName);
				that.SpikeList=data.SpikeVueList;
				that.DestinationList = data.DestinationList
				that.CategoryList = data.CategoryList
				
			} ).catch( (error)=>{
					
				console.log(error);
					
			} );
		}
	}
</script>

<style>
</style>
